function contour_func(func, region, h, varargin)
% Drawing a contour of func in 2D case.
% contour_func(@obj_func, region, h[, args]);
% region = [x_start, x_stop, y_start, y_end];
% h is the resolusion.
% args are the parameters for contour, e.g., the number of contou r lines.
    xN = ceil(region(2) - region(1)) / h;
    yN = ceil(region(4) - region(3)) / h;
    if (xN < 3 || yN < 3)
        disp ("Not enough resolution.");
        return;
    end
    N = xN * yN;
    x = linspace(region(1), region(2), xN);
    y = linspace(region(3), region(4), yN);
    [X, Y] = meshgrid(x, y);
    vx = reshape(X, 1, N);
    vy = reshape(Y, 1, N);
    fx = [vx; vy];
    vz = func(fx);
    Z = reshape(vz, yN, xN);
    contour(X, Y, Z, varargin{:});
end